package com.lin.sms.dao.impl;

import java.util.List;

import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.stereotype.Repository;

import com.lin.sms.dao.IUserDAO;
import com.lin.sms.dao.util.UserRowMapper;
import com.lin.sms.domain.User;

@Repository(value="userDao")
public class UserDAOImpl extends JdbcDaoSupport implements IUserDAO{

	@Override
	public User checkLogin(String name, String password) {
		String sql = "SELECT * FROM t_user WHERE name = ? AND password = ?";
		//Object[] params = {name,password};
		List<User> list = super.getJdbcTemplate().query(sql, UserRowMapper.getRowMapper(), name,password);
		return list.size() == 1 ? list.get(0) : null;
	}

}
